﻿@{
    Layout = null;
    ViewData["Title"] = "ShaiXuan";
}
<script src="~/js/vue.js"></script>
<script src="~/js/axios.js"></script>
<script src="~/element-ui/lib/index.js"></script>
<link rel="stylesheet" href="~/element-ui/lib/theme-chalk/index.css" />
<div id="app">
    <el-card class="box-card">
        <div slot="header" class="clearfix">
            <span>您正在做的业务是：人力资源--招聘管理--简历管理--简历筛选 </span>
        </div>
        <div>
            <el-descriptions :column="2" style="width:90%;" border>
                <el-descriptions-item>
                    <template slot="label">
                        请选择职位分类
                    </template>
                    <el-cascader expand-trigger="hover"
                                 :options="HeBingData"
                                 :props="cascaderProps"
                                 v-model="selectedKeys"
                                 v-on:change="parentCateChanged"
                                 clearable
                                 change-on-select
                                 ref="casc">
                    </el-cascader>
                </el-descriptions-item>
                <el-descriptions-item>
                    <template slot="label">
                        关键字
                    </template>
                    <el-input style="width:100%" v-model="fourName"></el-input>
                </el-descriptions-item>
                <el-descriptions-item>
                    <template slot="label">
                        登录时间
                    </template>
                    <el-date-picker type="date" style="width:35%" placeholder="选择日期" v-model="time1"></el-date-picker>至
                    <el-date-picker type="date" style="width:35%" placeholder="选择日期" v-model="time2"></el-date-picker>(YYYY-MM-DD)
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <el-button type="primary" v-on:click="TiaoJian()">查询</el-button>
                </el-descriptions-item>
            </el-descriptions>
            @*查询*@
            <el-table :data="tableData"
                      style="width: 100%"
                      v-show="isShow">
                <el-table-column prop="res_id"
                                 label="简历id"
                                 width="180"
                                 v-if="false">
                </el-table-column>
                <el-table-column prop="human_major_kind_name"
                                 label="职位分类"
                                 width="180">
                </el-table-column>
                <el-table-column prop="human_major_name"
                                 label="职位名称"
                                 width="180">
                </el-table-column>
                <el-table-column prop="human_name"
                                 label="姓名"
                                 width="180">
                </el-table-column>
                <el-table-column prop="human_mobilephone"
                                 label="手机号码"
                                 width="180">
                </el-table-column>
                <el-table-column prop="human_idcard"
                                 label="身份证号"
                                 width="180">
                </el-table-column>
                <el-table-column prop="human_history_records"
                                 label="个人履历"
                                 width="180">
                </el-table-column>
                <el-table-column prop="regist_time"
                                 label="登记时间"
                                 width="180">
                    <template v-if="(scope.row.regist_time!='0001-01-01T00:00:00')" slot-scope="scope">{{scope.row.regist_time | dateFormat}}</template>
                </el-table-column>
                <el-table-column prop="recomandation"
                                 label="推荐意见"
                                 width="180"
                                 v-if="false">
                </el-table-column>
                <el-table-column prop="interview_status"
                                 label="推荐面试"
                                 width="180"
                                 :formatter="selectState"
                                 v-if="false">
                </el-table-column>
                <el-table-column label="操作">
                    <template slot-scope="scope">
                        <el-button size="mini"
                                   v-on:click="Update(scope.row)">筛选</el-button>
                    </template>
                </el-table-column>
            </el-table>
        </div>
    </el-card>
    <el-dialog title="修改"
               :visible.sync="UpdVisible"
               width="50%">
        <span>
            <el-form :model="UpdateFrom" :rules="updrules" ref="UpdateFrom" label-width="100px" class="demo-ruleForm" size="mini">
                <el-col :span="11">
                    <el-form-item label="简历主键" prop="Res_id">
                        <el-input v-model="UpdateFrom.Res_id" readonly></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="11">
                    <el-form-item label="职位分类" property="human_major_kind_name">
                        <el-input v-model="UpdateFrom.human_major_kind_name" readonly></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="11">
                    <el-form-item label="职位名称" property="human_major_name">
                        <el-input v-model="UpdateFrom.human_major_name" readonly></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="11">
                    <el-form-item label="姓名" property="human_name">
                        <el-input v-model="UpdateFrom.human_name" readonly></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="11">
                    <el-form-item label="身份证号" property="human_idcard">
                        <el-input v-model="UpdateFrom.human_idcard" readonly></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="11">
                    <el-form-item label="手机号" property="human_mobilephone">
                        <el-input v-model="UpdateFrom.human_mobilephone" readonly></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="11">
                    <el-form-item label="注册时间" property="regist_time">
                        <el-input v-model="UpdateFrom.regist_time" readonly></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="11">
                    <el-form-item label="推荐意见">
                        <el-select v-model="UpdateFrom.Recomandation" placeholder="请选择" v-on:change="changeRecom">
                            @*<el-option v-for="item in optionsuv"
                            :key="item.UpdateFrom.Recomandation"
                            :label="item.UpdateFrom.Recomandation"
                            :value="item.UpdateFrom.Recomandation">
                            </el-option>*@
                            <el-option label="通过" value="通过"></el-option>
                            <el-option label="不通过" value="不通过"></el-option>
                        </el-select>
                    </el-form-item>
                </el-col>
                @*<el-col :span="11">
                <el-form-item label="推荐面试" prop="Interview_status">
                <el-input v-model="UpdateFrom.Interview_status" placeholder="0否/1是"></el-input>
                </el-form-item>
                </el-col>*@

            </el-form>
        </span>
        <span slot="footer" class="dialog-footer">
            <el-button v-on:click="UpdVisible = false">取 消</el-button>
            <el-button type="primary" v-on:click="UpdateOk()">确 定</el-button>
        </span>
    </el-dialog>
</div>
<script type="text/javascript">
    var vm = new Vue({
        el: "#app",
        data: {
            tableData: [],
            //级联属性
            HeBingData: [],
            cascaderProps: {
                value: "id",
                label: "name",
                children: "children",
            },
            selectedKeys: [],
            //查询开关
            isShow: false,
            fourName: "",
            time1: "",
            time2: "",
            updrules: {},
            UpdVisible: false,
            UpdateFrom: {
                Res_id: "",
                Recomandation: "",
                Interview_status: 0,
                human_name: "",
                human_mobilephone: "",
                human_idcard: "",
                regist_time: "",
                human_major_name: sessionStorage.getItem("major_name"),
                human_major_kind_name: sessionStorage.getItem("major_kind_name")
            }
        },
        methods: {
            //推荐意见下拉列表框值改变事件
            changeRecom(val){
                if (val == "通过") {
                    this.UpdateFrom.Interview_status = 1;
                }else{
                    this.UpdateFrom.Recomandation = "";
                }
            },
            //条件查询 点击打开查询
            TiaoJian() {
                // var aa = this.fourName;
                //console.info("值：",aa);
                if (this.fourName == '') {
                    //console.info("aa");
                    this.SeAll();
                } else {
                    this.isShow = true;
                    //console.info(this.zhi)
                    axios.get("/JianLiGuanLi/TiaoJian", { params: { type: this.zhi[0], name: this.zhi[1], fourName: this.fourName, time1: this.time1, time2: this.time2 } }).then(res => {
                        this.tableData = res.data;
                    })
                }
            },
            //查询全部
            SeAll() {
                axios.get("/JianLiGuanLi/SelAllJl").then(res => {
                    this.isShow = true;
                    this.tableData = res.data;
                })
            },
            //状态转换
            selectState(rows) {
                if (rows.interview_status == 0) return "否"
                if (rows.interview_status == 1) return "是"
            },
            //时间过滤器方法
            TimeGuoLvQi() {
                // 定义时间过滤器，
                Vue.filter('dateFormat', function(originDate, pattern = '') {
                    // 根据给定的时间字符串，得到特定的时间
                    var dt = new Date(originDate)
                    //   yyyy-mm-dd
                    var y = dt.getFullYear()
                    var m = (dt.getMonth() + 1).toString().padStart(2, '0')
                    var d = dt.getDate().toString().padStart(2, '0')
                    if (pattern.toLowerCase() === 'yyyy-mm-dd') {
                        return `${y}-${m}-${d}`
                    } else {
                        var hh = dt.getHours().toString().padStart(2, '0')
                        var mm = dt.getMinutes().toString().padStart(2, '0')
                        var ss = dt.getSeconds().toString().padStart(2, '0')
                        //return `${y}-${m}-${d}`
                        return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
                    }
                })
            },
            //职位分类 职位名称 查询方法
            FindHeBing() {
                axios.get("/JianLiGuanLi/HeBing").then(res => {
                    this.HeBingData = res.data;
                })
            },
            //职位分类，职位名称  改变事件
            parentCateChanged() {
                //选中值有就大于0
                if (this.selectedKeys.length > 0) {
                    //获取键
                    this.key = this.selectedKeys;
                    //console.info(this.selectedKeys);
                    //获取值
                    this.zhi = this.$refs["casc"].getCheckedNodes()[0].pathLabels;
                    //console.log(this.zhi)
                }
            },
            //简历管理筛选
            Update(row) {
                console.info("row:", row);
                //if (row.interview_status == 0) {
                //    console.info("jinlaile ???");
                //    this.UpdateFrom.Recomandation = "不通过";
                //}
                this.UpdateFrom.Res_id = row.res_id;
                this.UpdateFrom.human_major_kind_name = row.human_major_kind_name;
                this.UpdateFrom.human_major_name = row.human_major_name;
                this.UpdateFrom.Recomandation = row.Recomandation;
                this.UpdateFrom.Interview_status = row.interview_status;
                this.UpdateFrom.human_name = row.human_name;
                this.UpdateFrom.human_mobilephone = row.human_mobilephone;
                this.UpdateFrom.human_idcard = row.human_idcard;
                this.UpdateFrom.regist_time = row.regist_time;
                //打开修改模态框
                this.UpdVisible = true;
            },
            //查询出来的筛选 中的确定
            UpdateOk() {
                //如果状态等于0，则推荐意见为空
                if (this.UpdateFrom.Interview_status == 0) {
                    this.UpdateFrom.Recomandation = '';
                }
                axios.put("/JianLiGuanli/UpdateTwo", { Res_id: this.UpdateFrom.Res_id, Recomandation: this.UpdateFrom.Recomandation }).then(res => {
                    if (res.data > 0) {
                        alert("修改成功");
                        this.UpdVisible = false;
                        this.TiaoJian();
                    }
                })
            },
        },
        mounted() {
            this.FindHeBing();
            this.TimeGuoLvQi();
        },
    })
</script>
<style scoped>
    .el-descriptions-item__label.is-bordered-label {
        background: white;
        color: black;
    }

    .el-descriptions {
        height: 240px;
    }
</style>

